import { Card } from "@/core/cardsystem/card"
import { Player } from "@/core/playersystem/player"

type OneArgResolveFun = (arg: WaitForPushCardEvent) => void

export interface WaitForPushCardEvent {
    cancel: boolean,
    selectedCards: Card[],
    selectedPlayers: Player[]
}

export interface WaitForPushCardEventArgs {
    cancel?: boolean,
    selectedCards?: Card[],
    selectedPlayers?: Player[]
}

export function createDefaultEvent(args: WaitForPushCardEventArgs): WaitForPushCardEvent {
    const cancel = args.cancel || false
    const selectedCards = args.selectedCards || []
    const selectedPlayers = args.selectedPlayers || []

    return {cancel, selectedCards, selectedPlayers }
}

interface ReactiveState {

    // 等待点击按钮事件
    waitForButton: OneArgResolveFun

}



export default {
    namespaced: true,
    state: (): ReactiveState => ({
        waitForButton: (arg) => {},
    }),
    mutations: {
        setWaitForButton(state: ReactiveState, waitForButton: OneArgResolveFun) {
            state.waitForButton = waitForButton
        }
    },
    actions: {
        setWaitForButton({ commit }: {commit: any}, payload: OneArgResolveFun) {
            commit('setWaitForButton', payload)
        }
    }
}

